package com.example.customview;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

public class TestViewThree extends LinearLayout {

    //ui
    private TextView tvTitle;
    private TextView tvMessage;

    public TestViewThree(Context context) {
        this(context,null);
    }

    public TestViewThree(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public TestViewThree(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        LayoutInflater.from(context).inflate(R.layout.view_test_three,this,true);

        int padding = DisplayUtils.dpToPx(context,20);//20dp
        setOrientation(VERTICAL);
        setPadding(padding,padding,padding,padding);
        setLayoutParams(
                new LayoutParams(LayoutParams.MATCH_PARENT,DisplayUtils.dpToPx(context,150))
        );

        initViews();

    }

    private void initViews() {
        tvTitle = findViewById(R.id.tv_title_view_one);
        tvMessage= findViewById(R.id.tv_message_view_one);

    }


    public void setTitle(String title){
        tvTitle.setText(title);
    }

    public void setMessage(String message){
        tvMessage.setText(message);
    }
}